import { Injectable, Logger } from '@nestjs/common';
import { DeviceStatus } from '../common/enums';

@Injectable()
export class NotifyService {
  private readonly logger = new Logger(NotifyService.name);

  /**
   * Notify user about device status change
   * In a real application, this would send an email, SMS, or push notification
   */
  async notifyUserAboutDeviceStatusChange(
    userId: string,
    deviceId: string,
    serialNumber: string,
    newStatus: DeviceStatus,
    remark?: string,
  ): Promise<void> {
    this.logger.log(
      `Notification to user ${userId}: Device ${serialNumber} (${deviceId}) status changed to ${newStatus}. ${
        remark ? `Reason: ${remark}` : ''
      }`,
    );

    // In a real application, you would implement actual notification logic here
    // For example:
    // await this.emailService.sendEmail(userId, 'Device Status Change', `Your device ${serialNumber} status changed to ${newStatus}`);
  }
}
